home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- tee-handler/tee_handler
- tee-handler/tee_handler tee-handler/tee_handler
-
- NAME
- tee_handler -- Writes input to several outputs and StdOut. (V36)
-
- SYNOPSIS
- Open("TEE:[FileName_One][,FileName_Two][,...]");
-
- FUNCTION
-
- Background
- ----------
- In the UNIX environment, the output of a command can be displayed
- both on the terminal and saved to a file by using the command
- 'tee' and pipes:
-
- $ who | tee /users/log/970924_1300
-
- Even if there was a standard 'tee' utility available for the
- Amiga, it would be effectively useless with the standard Shell
- because AmigaShell lacks the pipe function. It could be
- simulated by saving the output and then 'type'ing it:
-
- 1.Work:> Dir >Work:SysList/970924 SYS: ALL
- 1.Work:> Type Work:SysList/970924
-
- But this uses two command lines, and what if you need monitor
- the output while it's being saved? There is the PIPE: handler,
- and you could try this:
-
- 1.Work:> Dir >PIPE:blabla SYS: ALL
- 2.Work:> tee <PIPE:blabla Work:SysList/970924
-
- But, once again, this uses two commands, and these are on two
- different Shells! And while there are shells with pipes
- (eg CShell, ZShell etc.), most either use PIPE: with one Shell,
- requiring the whole output to be read first, or save the output
- to a temporary file, which is also pretty inefficient if you're
- going to be saving the file anyway.
-
- The Tee-Handler
- ---------------
- TeeHandler was written to overcome these limitations. With it, you
- can write the standard output of any command to both the Shell and
- to zero or more output files. Any type of output file can be
- specified, including DOS Devices like PRT:, SER:, PIPE: etc. The
- output is immediate, you don't have to wait for the whole output
- to be generated before you see it.
-
- TeeHandler is implemented as a DOS Device. The standard name
- is "TEE:", followed by a list of filenames seperated by commas,
- eg:
-
- 1.Work:> Dir >TEE:One,Two,Three
-
- If you need to include a comma in you're filename, you can 'escape'
- it with the backslash (\). so that eg:
-
- 1.Work:> Dir >TEE:One\,Two
-
- Would produce a file in the current directory called "One,Two".
- Any character preceded by a backslash will be 'escaped', so you
- can use '\\' to get one '\' in your filename.
-
- NOTE: If you need to use the character '^' as the first character
- in your filename, please 'escape' it with '\^'. Although
- it isn't yet implememted, I will be using this character in
- future versions to provide options to the handler about what
- to do with this file.
-
- You can append the output to your output files be using the
- double redirection '>>' eg:
-
- 1.Work:> Dir >>TEE:One,Two,Three
-
- This will open three files in Read/Write mode and Seek them to the
- end (this is done by the Shell, but handled by TEE).
-
- You may specify no files, in which case the output is redirected
- only to the StdOut. Invalid filenames (ie those that cause
- Open() to return NULL) and empty filenames are ignored.
-
- Note that you may use colons (:) and forward-slashes (/) as normal
- in your filenames.
-
- INPUTS
- FileName_One - Name of first output file.
-
- FileName_Two - Name of second output file, etc
-
- PACKETS
- ACTION_FINDUPDATE
- ACTION_FINDOUTPUT
- ACTION_SEEK
- ACTION_WRITE
- ACTION_END
- ACTION_IS_FILESYSTEM
-
- MOUNTLIST ENTRY
- This is the default mountlist entry used for tee-handler:
-
- TEE: Handler = L:tee-handler
- Priority = 0
- Stacksize = 4096
- GlobVec = -1
- #
-
- EXAMPLES
- List directory to both the Shell and a single file:
- Dir >TEE:Filename
-
- List directory to the Shell and several files:
- Dir >TEE:Filename1,Filename2,Filename3
-
- List directory to the Shell and append it to several files:
- Dir >>TEE:Filename1,Filename2,Filename3
-
- Copy a file to both the Shell and several other files:
- Copy S:Startup-Sequence TEE:Filename1,Filename2,Filename3
-
- Copy a file to both the Shell, the printer and a serial terminal:
- Copy S:Startup-Sequence TEE:PRT:,SER:
-
- List directory to the Shell and a file with commas in the filename:
- Dir >TEE:File\,Name\,With\,Commas
-
- List directory to the Shell and a file with spaces in the filename:
- Dir >"TEE:File Name With Spaces"
-
- List directory to the Shell and append files with spaces and commas:
- Dir >>"TEE:One,Two,Three Four,Five\,Six"
-
- HISTORY
- v1.39 (21st Oct 1997)
- Initial Release
-
- v1.40 (17th December 1997)
- Fixed a problem with buffering. In the previous release,
- AmigaDOS viewed TEE: as a normal file and buffered the
- output. This resulted in jerky and disjointed `spurts' of
- output. In this version, TEE: is recognised as an interactive
- stream (like a console), and the output is written at the end
- of each line. For those that are interested, this was achieved
- by setting the FileHandle's fh_Port field to DOSTRUE (-1L)
- instead of NULL.
-
- BUGS
- TeeHandler will freeze if asked to output to itself, eg
- Dir >TEE:TEE:...
-
- AUTHOR
- The author of this handler is Karl J. Ots. You can contact me via
- my e-mail address:
-
- kjots@gem.menzies.latrobe.edu.au
-
- And visit my web page:
-
- http://gem.menzies.latrobe.edu.au/~kjots
-
- All my software is available from my web page.
-